feat: Go CLI skeleton — version command and lola mod stubs#188
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (16)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (15)
📝 WalkthroughWalkthroughThis PR establishes the Go project skeleton for lola, introducing build infrastructure, a Cobra-based CLI framework with root and version commands, and a module management command group with operation stubs that currently return a sentinel "not yet implemented" error. ChangesGo Project Skeleton
Sequence DiagramsequenceDiagram
participant main as main()
participant Execute as cmd.Execute()
participant rootCmd as rootCmd
participant currentVersion as currentVersion()
participant resolveVersion as resolveVersion()
participant versionCmd as versionCmd
main->>Execute: invoke
Execute->>rootCmd: rootCmd.Execute()
rootCmd->>currentVersion: Load version
currentVersion->>resolveVersion: Resolve with<br/>fallback chain
resolveVersion-->>currentVersion: Return version
currentVersion-->>rootCmd: Set version
rootCmd->>versionCmd: Register and run
versionCmd-->>rootCmd: Print version +<br/>platform info
rootCmd-->>Execute: Return result
Execute-->>main: Exit(1) on error
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e2ae4b9dc
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Note: This is not a review. @mrbrandao try to use an agent to extract the feature files from #184 and write the steps for Go to check the feasibility of that PR for the Go implementation. (No need to change this PR, just a test to see how it goes.) |
sounds good, will be separating an MR just with that |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
cmd/root.go (1)
24-29: ⚡ Quick winReturn errors from
Execute()and exit only inmain().Handling
os.Exitinsidecmd.Execute()makes command execution harder to test and reuse.Refactor proposal
--- a/cmd/root.go +++ b/cmd/root.go @@ -import ( - "os" - - "github.com/spf13/cobra" -) +import "github.com/spf13/cobra" @@ -func Execute() { - err := rootCmd.Execute() - if err != nil { - os.Exit(1) - } +func Execute() error { + return rootCmd.Execute() }--- a/main.go +++ b/main.go @@ package main -import "github.com/LobsterTrap/lola/cmd" +import ( + "os" + + "github.com/LobsterTrap/lola/cmd" +) func main() { - cmd.Execute() + if err := cmd.Execute(); err != nil { + os.Exit(1) + } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@cmd/root.go` around lines 24 - 29, The Execute() function is handling os.Exit() internally, which prevents proper testing and reuse of the command execution logic. Refactor Execute() to return the error from rootCmd.Execute() instead of handling the exit directly. Move the os.Exit() call to the main() function where the returned error can be checked and the process can be exited appropriately. This allows Execute() to be tested and reused without side effects.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@cmd/root.go`:
- Around line 18-21: The quick-start help text in the Long field of the root
command in cmd/root.go references the lola install command which does not yet
exist in the codebase. Remove the line containing lola install [module] -a
[assistant] from the help text to prevent users from attempting to use a
non-existent command.
In `@main.go`:
- Around line 1-4: The copyright header in main.go contains placeholder template
text "NAME HERE <EMAIL ADDRESS>" that must be replaced with actual
project-specific copyright information. Either replace the placeholder with the
appropriate copyright holder name and email, or remove the placeholder entirely
and finalize the copyright header text later when project details are confirmed.
Update the comment block at the beginning of the file to reflect the actual
copyright requirements for this project.
---
Nitpick comments:
In `@cmd/root.go`:
- Around line 24-29: The Execute() function is handling os.Exit() internally,
which prevents proper testing and reuse of the command execution logic. Refactor
Execute() to return the error from rootCmd.Execute() instead of handling the
exit directly. Move the os.Exit() call to the main() function where the returned
error can be checked and the process can be exited appropriately. This allows
Execute() to be tested and reused without side effects.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d465517f-9c69-48a8-bdf0-d718cb065eea
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (16)
.gitignoreMakefilecmd/mod.gocmd/root.gocmd/version.gocmd/version_test.gogo.modinternal/modules/add.gointernal/modules/errors.gointernal/modules/info.gointernal/modules/init.gointernal/modules/ls.gointernal/modules/rm.gointernal/modules/update.gomain.gomk/go.mk
✅ Files skipped from review due to trivial changes (2)
- .gitignore
- internal/modules/ls.go
🚧 Files skipped from review as they are similar to previous changes (10)
- go.mod
- internal/modules/update.go
- cmd/version_test.go
- internal/modules/info.go
- internal/modules/add.go
- cmd/version.go
- mk/go.mk
- internal/modules/init.go
- internal/modules/errors.go
- cmd/mod.go
|
Keeping |
Add .tool-versions to .gitignore to prevent local asdf version configuration from being tracked by git.
Initialize Go module and root command scaffold for the lola CLI, using github.com/spf13/cobra as the CLI framework.
… domain Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… test - Replace currentVersion() call in versionCmd.Run with cmd.Root().Version for single source of truth between 'lola version' and 'lola --version' - Add boundary test case for exactly 7-char vcsRevision to cover min(7, len(vcsRevision)) logic - All tests pass including new case Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Adds Go build targets to the Makefile alongside existing Python targets. Includes version stamping from git tags via LDFLAGS when on a tag, otherwise falls through to VCS stamping for dev builds. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Add standard Go ignores (binaries, test artifacts, coverage output, go.work), exclude also custom bin/ dir
Summary
Bootstraps the Lola Go CLI with the initial project structure, version
command, and
lola modskeleton. This is the first PR in the Go portseries (
go-port-00), establishing the foundation for all subsequentcommand implementations.
main.go,cmd/root.go)lola version/lola --version/lola -vwith dynamic versionresolution (ldflags →
go installmodule version → VCS commit hash →0.0.0-devfallback)lola modcommand group with 6 no-op subcommands:add,rm,ls,info,update,initinternal/modules/domain package with stub functions and per-packageerror sentinel (
ErrNotImplemented)mk/go.mkwithgo-build,go-test,go-vetMakefile targets.gitignoreupdated with Go and SuperPowers sectionsTest plan
lola --version/lola -vprints version string (e.g.0.0.0-dev+279d87c)lola versionprintslola version 0.0.0-dev+279d87c linux/amd64lola mod --helplists all 6 subcommands, nosearchlola mod <sub>printsnot yet implementedto stderr, exits 1make go-testpassesmake go-vetcleanRelated issues
Closes #182 — Go project skeleton
Part of the Go migration (ADR: go-migration)
AI Disclosure
AI-assisted with Claude Code
Summary by CodeRabbit
modsubcommands (add, rm, ls, info, update, init) for module management (currently scaffolded and returns “not yet implemented”).versioncommand with resolved version details andGOOS/GOARCH.